/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.bean;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import javax.enterprise.context.SessionScoped;
import javax.inject.Named;

/**
 *
 * @author _HungChilvas_
 */
@Named(value = "autoCompleteView")
@SessionScoped
public class AutoCompleteView implements Serializable {

    /**
     * Creates a new instance of SelectOneView
     */
    List<String> lstAllCity = new ArrayList<String>();

    public AutoCompleteView() {
        lstAllCity.add("Hanoi, Vietnam");
        lstAllCity.add("Hoan Kiem District,Hanoi,Vietnam");
        lstAllCity.add("Hai Ba Trung District, Hanoi, Vietnam");
        lstAllCity.add("Ba Dinh, Hanoi, Vietnam");
        lstAllCity.add("Vietnam airlines, Ly Nam De, Hanoi, Ba Dinh, Vietnam");
        lstAllCity.add("Hacino Real Estate Trading Center, Hanoi, Vietnam");
        lstAllCity.add("Ton  That Thuyet, My Dinh 2, Hanoi, Vietnam");
        lstAllCity.add("Ben xe My Dinh, Pham Hung, Hanoi, Vietnam");
        lstAllCity.add("Công viên Nghĩa Đô, Nguyễn Văn Huyên, Hanoi, Vietnam");
        lstAllCity.add("Thanh Xuan, Hanoi, Vietnam");
        lstAllCity.add("Hoang Hoa Tham, Hanoi, Vietnam");
        lstAllCity.add("Thanh Tri, Hanoi, Vietnam");
        lstAllCity.add("Sieu Thi Big C The Garden, Me Tri, Hanoi, Vietnam");
        lstAllCity.add("Rap chieu phim Quoc Gia, Hanoi, Vietnam");
        lstAllCity.add("Royal City, Thanh Xuan, Hanoi, Vietnam");
        lstAllCity.add("Big C Long Bien, Gia Thuy, Hanoi, Vietnam");
        lstAllCity.add("TTC Tower, Hanoi, Vietnam");
        lstAllCity.add("VnExpress, Hanoi, Vietnam");
        lstAllCity.add("FPT Shop, Hanoi, Vietnam");
        lstAllCity.add("FPT University, Hanoi, Vietnam");
        lstAllCity.add("Bao Tai Nguyen & Moi Truong, Hanoi, Vietnam");

        path = "https://www.google.com/maps/embed/v1/search?q=+Hanoi, Vietnam&key=AIzaSyAxLVqBfAWr9zYdN3cfdZYCMov7l-o8HrI";
    }
    private String address;

    public List<String> getLstAllCity() {
        return lstAllCity;
    }

    public void setLstAllCity(List<String> lstAllCity) {
        this.lstAllCity = lstAllCity;
    }

    private String path;

    public String getPath() {
        return path;
    }

    public void setPath(String path) {
        this.path = path;
    }

    public void searchGoogleMap() {
        String city = address;
        path = "https://www.google.com/maps/embed/v1/search?q=+" + city + "&key=AIzaSyAxLVqBfAWr9zYdN3cfdZYCMov7l-o8HrI";

    }

    public List<String> completeText(String querry) {
        List<String> results = new ArrayList<>();
        for (String city : lstAllCity) {
            if (city.toUpperCase().contains(querry.toUpperCase())) {
                results.add(city);
            }
        }
        return results;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }
}
